﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：john
    //
    // 文件名：CompanyManageInfo_SC.aspx.cs
    // 文件功能描述：配送企业信息查看
    // 创建标识：john 2011 - 07 - 23
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
// 审核时间：
// 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; 
using HZ.Supervise.Model;
using HZ.Supervise.IBLL;
using System.Data;
using HZ.Supervise.Model.Enum;

namespace HZ.Supervise.Web.SystemManage
{
    public partial class CompanyManageInfo_PS :BasePage
    {
        public CompanyManageInfo_PS()
        {
            this.ModuleNo = Module.基础信息库.ToString();
            PageOperateType = OperateType.配送企业信息.ToString();
        }
        IBLL_PreWarning ip = HZ.Supervise.BLLFactory.IBLL_PreWarning();

        protected void Page_Load(object sender, EventArgs e)
        {
            SetBind();
        }

        /// <summary>
        /// 绑定数据信息
        /// </summary>
        private void SetBind()
        {
            int totalCount;
            Model.Company com = new HZ.Supervise.Model.Company();
            com.CompanyName = txtCompanyName.Text.Trim();
            DataTable dt = ip.GetCompanyInfo(com, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount); 
            
            AspNetPager1.RecordCount = totalCount;
            gvwHospital.DataSource = dt;
            gvwHospital.DataBind();
        }


        //protected string getQuery()
        //{
        //    string where = "";
        //    if (!string.IsNullOrEmpty(txtCompanyID.Text.Trim()))
        //    {  
        //        where += string.Format(" AND CompanyID ='{0}'", txtCompanyID.Text.Trim());
        //    }

        //    if (!string.IsNullOrEmpty(txtCompanyName.Text.Trim()))
        //    {
        //        where += string.Format(" AND CompanyName LIKE '%{0}%'", txtCompanyName.Text.Trim());
        //    }


        //    return where;
        //}
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
        }

        /// <summary>
        /// 翻页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            SetBind();
        }

        /// <summary>
        /// 返回企业名称列输出，配送企业加上查看信息链接，非配送企业直接输出名称
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="companyName"></param>
        /// <param name="companyType"></param>
        /// <param name="companyType"></param>
        /// <returns></returns>
        protected string GetCompanyRender(string companyId, string companyName, int companyType)
        {
            if (companyType == 2)
            {
                return "<a href=\"javascript:void(0)\"  title=\"查看配送企业详细信息\" onclick=\"window.open('../../CommonPage/CompanyInfo.aspx?companyid=" + companyId + "','selectCompany','width=550,height=350,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')\" >" + companyName + "</a>";
            }
            else
            {
                return companyName;
            }
        }
    }
}
